<#assign className = table.classNameBo>

<#include "/macro.include"/>
<#assign classNameLower = className?uncap_first>

<#assign isCbd = false>

<#list table.columns as column>
    <#if column=='creator'>
        <#assign isCbd = true>
    </#if>
</#list>


package ${basepackage}.core.Entity;

import com.hp.up.core.Entity.IdEntity;

import java.util.*;

/**
 * ${table.remarks}
 */
public class ${className} extends IdEntity{
<#list table.columns as column>
<#if column='id' || column='create_by' || column='create_uid' || column='modify_by' || column='modify_uid' || column='create_date' || column='modify_date' || column='agent_id'>
<#else>
	/**
	 * ${column.remarks}
	 */
	private ${column.possibleShortJavaType} ${column.columnNameFirstLower};
</#if>

</#list>

<@generateConstructor className/>
<@generateJavaColumns/>
<@generateJavaOneToMany/>
<@generateJavaManyToOne/>
}

<#macro generateJavaColumns>
<#list table.columns as column>
    <#if column.isDateTimeColumn>

    </#if>
<#if column='id' || column='create_by' || column='create_uid' || column='modify_by' || column='modify_uid' || column='create_date' || column='modify_date' || column='agent_id'>
<#else>
    public void set${column.columnName}(${column.possibleShortJavaType} value) {
        this.${column.columnNameFirstLower} = value;
    }

    public ${column.possibleShortJavaType} get${column.columnName}() {
        return this.${column.columnNameFirstLower};
    }
</#if>
</#list>
</#macro>

<#macro generateJavaOneToMany>
	<#list table.exportedKeys.associatedTables?values as foreignKey>
	<#assign fkSqlTable = foreignKey.sqlTable>
	<#assign fkTable    = fkSqlTable.className>
	<#assign fkPojoClass = fkSqlTable.className>
	<#assign fkPojoClassVar = fkPojoClass?uncap_first>
	
	private Set ${fkPojoClassVar}s = new HashSet(0);
	public void set${fkPojoClass}s(Set<${fkPojoClass}> ${fkPojoClassVar}){
		this.${fkPojoClassVar}s = ${fkPojoClassVar};
	}
	
	public Set<${fkPojoClass}> get${fkPojoClass}s() {
		return ${fkPojoClassVar}s;
	}
	</#list>
</#macro>

<#macro generateJavaManyToOne>
	<#list table.importedKeys.associatedTables?values as foreignKey>
	<#assign fkSqlTable = foreignKey.sqlTable>
	<#assign fkTable    = fkSqlTable.className>
	<#assign fkPojoClass = fkSqlTable.className>
	<#assign fkPojoClassVar = fkPojoClass?uncap_first>
	
	private ${fkPojoClass} ${fkPojoClassVar};
	
	public void set${fkPojoClass}(${fkPojoClass} ${fkPojoClassVar}){
		this.${fkPojoClassVar} = ${fkPojoClassVar};
	}
	
	public ${fkPojoClass} get${fkPojoClass}() {
		return ${fkPojoClassVar};
	}
	</#list>
</#macro>
